package com.by.controller;

import com.by.bean.User;
import com.by.common.core.bean.ResultBean;
import com.by.common.core.controller.BaseController;
import com.by.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sys")
@Api(tags = "用户管理")
@Slf4j
public class UserController extends BaseController {

    @Autowired
    UserService userService;

    @ApiOperation("保存用户")
    @PostMapping("/user")
    public ResultBean save(@RequestBody User user) {
        int rs = userService.saveEntity(user);
        log.info("保存用户的结果:" + rs);
        return saveResult(rs);
    }
}
